/*
 * @lc app=leetcode.cn id=812 lang=rust
 *
 * [812] 最大三角形面积
 */

// @lc code=start
impl Solution {
    pub fn largest_triangle_area(points: Vec<Vec<i32>>) -> f64 {
        let mut area:f64 = 0.0;

        for i in 0..points.len() {
            for j in i+1..points.len() {
                for k in j+1..points.len(){
                    let i = &points[i];
                    let j = &points[j];
                    let k = &points[k];
                    let mut t = (j[0] - i[0]) * (k[1] - i[1]) - (k[0] - i[0]) * (j[1] - i[1]);
                    if t < 0 { t = -t; }

                    let tmp:f64 = (t as f64 ) * 0.5;
                    if area < tmp {
                        area = tmp;
                    }
                }
            }
        }

        return area;
    }
}
// @lc code=end

